<?php 
include_once 'root.php';
Class Product extends Root{
	public function __construct(){
		parent::__construct();
		$this -> load -> helper('util');
	}
	public function index(){
		$this->data['header'] = "รายการสินค้า";
		$this -> data['canSearch'] = $this -> canUseFunction("product","search");
		$this->pagination->create_links();
		
		$q  = $this->getCoreQuery($this -> data['canSearch']);
		
		
		$this->load->model("productmodel");
		$this->data['mainGroup'] = $this->productmodel->getMainGroup();
		$allRow = $this->productmodel->getAllCountProduct($q);
		$pageConfig = $this->initPagination($allRow);;
		$this->data['pagination'] = $this->pagination;
		$this->data['dataList'] = $this->productmodel->getProduct($pageConfig['start'],$pageConfig['limit'],$q);		
		$this->includeView("viewproduct");
		
	}
}
?>